package org.halo.trade.data.http;

import java.io.IOException;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.util.EntityUtils;

public class BooleanResponseHandler implements ResponseHandler<Boolean>
{
	@Override
	public Boolean handleResponse(HttpResponse response) throws ClientProtocolException, IOException
	{
		if (response.getStatusLine().getStatusCode() == 200)
		{
			// Utils.savecookies(cookieStore, cookiesFile);
			HttpEntity entity = response.getEntity();
			// String response = EntityUtils.toString(entity, "utf-8");//
			// 将entity当中的数据转换为字符串
			// System.out.println("Http post response:"+ response);
			EntityUtils.consume(entity);
			System.out.println("login ok!");
			return true;
		}
		return false;
	}
};